:root {
    --primary-color: #4a6bdf;
    --primary-hover: #3a56c0;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --success-color: #2ecc71;
    --success-hover: #27ae60;
    --text-color: #333;
    --text-muted: #6c757d;
    --border-color: #e0e0e0;
    --background-color: #f8f9fa;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --input-focus: 0 0 0 3px rgba(74, 107, 223, 0.2);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.app-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 800px;
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    background-color: var(--primary-color);
    color: white;
}

.card-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-body {
    padding: 1.5rem;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}

.required {
    color: var(--danger-color);
    font-size: 1rem;
}

.form-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.input-with-icon {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--input-focus);
}

.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dynamic-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: var(--transition);
}

.dynamic-item:hover {
    background-color: #f1f3f5;
}

.dynamic-item-content {
    display: flex;
    flex: 1;
    gap: 1rem;
    flex-wrap: wrap;
}

.dynamic-item-content .input-with-icon {
    flex: 1;
    min-width: 150px;
}

.btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-add {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-add:hover {
    background-color: var(--primary-hover);
}

.btn-remove {
    background-color: var(--danger-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.btn-remove:hover {
    background-color: var(--danger-hover);
}

.btn-submit {
    background-color: var(--success-color);
    color: white;
    padding: 0.75rem 1.5rem;
}

.btn-submit:hover {
    background-color: var(--success-hover);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.weight-explanation {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0 1rem;
    padding: 0.75rem;
    background-color: #f0f6ff;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weight-explanation i {
    color: var(--primary-color);
    font-size: 1rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .card {
        width: 95%;
        margin: 0 auto;
    }

    .card-header h1 {
        font-size: 1.3rem;
    }

    .dynamic-item {
        flex-direction: column;
        gap: 1rem;
    }

    .dynamic-item-content {
        width: 100%;
    }

    .dynamic-item-content .input-with-icon {
        min-width: 100%;
    }

    .btn-remove {
        width: 100%;
        height: auto;
        border-radius: 8px;
        padding: 0.5rem;
    }

    .form-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .card-header, .card-body {
        padding: 1rem;
    }

    .app-container {
        padding: 1rem 0.5rem;
    }

    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
    }

    .weight-explanation {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
}

/* index.html 新增以下样式 */
.card-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--input-focus);
}

.btn-default {
    background-color: #fff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-default:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.table-responsive {
    overflow-x: auto;
}

.supplier-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.supplier-table th,
.supplier-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.supplier-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--text-color);
}

.supplier-table tr:hover {
    background-color: #f8f9fa;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-enabled {
    background-color: #d4edda;
    color: #155724;
}

.status-disabled {
    background-color: #f8d7da;
    color: #721c24;
}

.expand-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.expand-btn.expanded {
    transform: rotate(180deg);
}

.model-row {
    background-color: #f8f9fa !important;
}

.model-list-container {
    padding: 1rem;
    margin: 0.5rem 0;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.model-table {
    width: 100%;
    border-collapse: collapse;
}

.model-table th,
.model-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.model-table th:first-child,
.model-table td:first-child {
    width: 33%;
}

.model-table th:nth-child(2),
.model-table td:nth-child(2) {
    width: 33%;
}

.model-table th:nth-child(3),
.model-table td:nth-child(3) {
    width: 34%;
}

.model-table tr:last-child td {
    border-bottom: none;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-pagination {
    padding: 0.5rem 1rem;
    background-color: #fff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-pagination:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #fff;
    color: var(--primary-color);
}

.page-numbers {
    display: flex;
    gap: 0.25rem;
}

.page-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.page-number:hover {
    background-color: #f0f2f5;
}

.page-number.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* 调整表格列宽 */
.supplier-table th:first-child,
.supplier-table td:first-child {
    width: 40px;
    text-align: center;
    padding: 0;
}

/* 展开按钮样式调整 */
.expand-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.3s ease;
    border-radius: 50%;
}

.expand-btn:hover {
    background-color: #f0f2f5;
}

.expand-btn.expanded {
    transform: rotate(180deg);
}

/* 操作按钮调整 */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

@media (max-width: 768px) {
    .card-toolbar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .search-box {
        width: 100%;
    }

    .supplier-table th,
    .supplier-table td {
        padding: 0.75rem 0.5rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-action {
        width: 100%;
    }

    .pagination-container {
        flex-direction: column;
        gap: 1rem;
    }
}